#!/usr/bin/env python3
# -*- coding:UTF-8 -*-
# Author: nigo

# 访问元素
# students = ['张三', '李四', '王五', '赵六']
# count = len(students)
# last_student = students[count - 1]
# print(last_student)

# 切片

# numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
# print(numbers[:3])
# print(numbers[4:6])
# print(numbers[-3:])

# 添加元素
# students = []
# students.append('张三')
# students.append('李四')
# students.append('王五')
# students.append('赵六')
# print(students)

# 插入元素
# students = ['张三', '李四', '王五', '赵六']
# students.insert(1, '狗二蛋')
# print(students)

#删除元素
# students = ['张三', '狗二蛋', '李四', '王五', '赵六']
# del students[1]
# print(students)
# students.remove('狗二蛋')
# print(students)

# 排序
numbers = [5, 2, 3, 4, 1, 6, 7, 8, 9]
numbers.sort() # 正序
print(numbers)
numbers.sort(reverse=True) # 倒序
print(numbers)
